<%@page import="models.UserModel"%>
<%@page import="java.util.TreeMap"%>
<%@page import="helpers.UrlHelper"%>

<%
TreeMap check = (TreeMap) request.getAttribute("check");
String success = (String) request.getAttribute("success");
UserModel user = (UserModel) request.getAttribute("user");
String form = (String) request.getAttribute("form");
%>

<jsp:include page="/admin/layouts/header.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>

<script type="text/javascript" src="/admin/js/form_user.js"></script>
		
		<div class="maincontent noright">
        	<div class="maincontentinner">
                <ul class="maintabmenu multipletabmenu">
                	<li class="current"><a href="#">User Form</a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
					<% if (success != null) {%>
					<div class="notification msgsuccess">
                        <a class="close"></a>
                        <p><%=success %></p>
                    </div>
					<% } %>
                    <div class="contenttitle">
                    	<h2 class="form"><span>Add User</span></h2>
                    </div><!--contenttitle-->
            
                    <form method="post" action="#" class="stdform stdform2" id="edit_user_form">
                    	
                        <p>
                        	<label>Username</label>
                            <span class="field">
                            	<input type="text" class="smallinput" name="username" id="u_username" value="<%=user.getUsername() != null ? user.getUsername() : "" %>">
                            	<% if (check.get("username") != null) { %>
									<label for="u_username" generated="true" class="error"><%=check.get("username") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Full name</label>
                            <span class="field">
                            	<input id="u_fullname" class="mediuminput" type="text" name="fullname" value="<%=user.getFullname() != null ? user.getFullname() : "" %>" maxlength="100">
                            	 <% if (check.get("fullname") != null) { %>
									<label for="u_fullname" generated="true" class="error"><%=check.get("fullname") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Status</label>
                            <span class="field">
                            	<select id="u_status" name="status" class="smallinput">
									<option value="0" <%=user.getStatus() == 0 ? "selected=\"selected\"" : "" %>>Inactive</option>
									<option value="1" <%=user.getStatus() == 1 ? "selected=\"selected\"" : "" %>>Pending</option>
									<option value="2" <%=user.getStatus() == 2 ? "selected=\"selected\"" : "" %>>Active</option>
								</select>
								<% if (check.get("status") != null) { %>
									<label for="u_status" generated="true" class="error"><%=check.get("status") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Role Access</label>
                            <span class="field">
                            	<select id="u_role" name="role" class="smallinput">
									<option value="0" <%=user.getRole() == 0 ? "selected=\"selected\"" : ""%>>User</option>
									<option value="1" <%=user.getRole() == 1 ? "selected=\"selected\"" : ""%>>Creator</option>
									<option value="2" <%=user.getRole() == 2 ? "selected=\"selected\"" : ""%>>Admin</option>
								</select>
								<% if (check.get("role") != null) { %>
									<label for="u_role" generated="true" class="error"><%=check.get("role") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p class="stdformbutton">
                        	<button class="submit radius2">Submit Button</button>
                            <input type="reset" value="Reset Button" class="reset radius2">
                        </p>
                        
                    </form>
                    
                    <br clear="all">
                    
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp">
            	<jsp:param name="language" value="1" />
			</jsp:include>
            
        </div>

<jsp:include page="/admin/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>